package com.wynne.ptldemo.service.serviceimpl;

import akka.actor.ActorRef;
import akka.actor.ActorSelection;
import akka.actor.ActorSystem;
import com.wynne.ptldemo.bo.TagSignalBo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageDispatcher {

    @Autowired
    private ActorSystem actorSystem;

    public void dispatcherMessage(TagSignalBo signalBo) {
        ActorSelection actorSelection = actorSystem.actorSelection("user/control@" + signalBo.getControlNo());
        actorSelection.tell(signalBo, ActorRef.noSender());
    }
}
